Conversation
… serialize if kind != template
…shipElements and BasicEvents
- added unit test to AML serializer
…s instead of plural names)
| private final AmlDeserializer deserializer = new AmlDeserializer(); | ||
|
|
||
| @Test | ||
| @Ignore |
There was a problem hiding this comment.
Is there a reason that the test is ignored?
There was a problem hiding this comment.
Yes, as AmlDeserializer is not yet fully implemented and therefore the test would fail.
| */ | ||
| package io.adminshell.aas.v3.dataformat.aml.serialize; | ||
|
|
||
| import io.adminshell.aas.v3.dataformat.aml.fixtures.FullExample; |
There was a problem hiding this comment.
The FullExample.java file is meant to be reused from other tests too? Maybe consider moving the AAS objects created for this test in the same file to make it independent
There was a problem hiding this comment.
Yes, you are right (in general). We are already working on this, however, FullExample is currently not 100% consistent acrosss different serialization formats. The reason for this is, that when implementing AML we realized that the full example is actually not 100% valid according to the constraints but this has not caused issues in other serialization formats as they are more "error-friendly" e.g. unresolvable references do not cause JSON serializer to crash as references are just serialized as string whereas in AML unresolvable references can cause a crash because sometimes these references are resolved and the referenced element is inlined.
We are working on unifying FullExample.java but we postponed this task until validation is implemeted and we can be sure that we fix all issues in the FullExample in one go as this requires slight adjustments to the expected results of the unit tests of all serializers.
| .normalizeWhitespace() | ||
| .withNodeMatcher(new DefaultNodeMatcher( | ||
| ElementSelectors.conditionalBuilder() | ||
| .whenElementIsNamed("Attribute") |
There was a problem hiding this comment.
It is not clear to me the usage of these when...then statements in the for the test assertion. Is is a kind of mapping that could have been done at an earlier stage?
There was a problem hiding this comment.
These are instructions on how to compare the generated XML/AML to the expected XML/AML. The used framework only works on XML and compares nodes of the XML tree based on node name which in case of AML is most of the time either Attribute or InternalElement. As in AML each element typically has multiple sub-elements of type Attribute and/or InternalElement. These statements specify that e.g. an element is named "Attribute" it should be compare not with another element named "Attribute" at the same position in the other file but with another element that is also named "Attribute" and has the same value for attribute "Name".
Basically, these rules define how to uniquely identify an Attribute/InternalElement/ExternalInterface so that order of elements is not important when comparing AML files.
This PR adds the AutomationML serializer.